All Functions Used So Far, Week 8

recode

{dplyr}

Recode a variable

seq

{base}

Create a sequence

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

var

{stats}

Calculate variance

write.csv

{utils}

write a csv file to a data frame

separate

{dplyr}

Separate a character column into multiple columns

sd

{stats}

Get standard deviation of a vector

boxplot

{graphics}

Plot a simple box plot

data.frame

{base}

Create a data.frame from vectors

library

{base}

Load an R package

max

{base}

Get maximum of a vector

min

{base}

Get minimum of a vector

as.numeric

{base}

Coerce a vector to numeric

n

{dplyr}

The number of observations in the current group.

names

{base}

Retrieve names of a list/vector

c

{base}

Combine values/vectors into a vector

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

factor

{base}

Create a factor

str

{utils}

Get the structure of an R object

filter

{dplyr}

Filter out rows of a data frame according to logical vector

select

{dplyr}

Select columns from a tibble/data frame

hist

{graphics}

Plot a simple histogram

setwd

{base}

Set Working Directory

read_excel

{readxl}

Read an Excel file

geom_histogram

{GGPLOT2}

Generates a histogram

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

is.na

{base}

Check if a value is NA/elements of vector are NA

desc

{dplyr}

Arrange in descending order

ungroup

{dplyr}

Resolve grouping created with “group_by”

summarize

NA

ordered

{dplyr}

Create an ordered factor

mutate

{dplyr}

Modify/create a column in a data frame

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

sum

{base}

Get sum of numeric values or a vector

as.character

{base}

Coerce a vector to character

summary

{base}

Obtain summary statistics or detailed regression output

labs

{GGPLOT2}

Customise labels in GGPLOT2

cut

{base}

Convert Numeric to Factor

ifelse

{base}

Return a or b depending on the value of test

mean

{base}

Get mean of a vector

range

{base}

Return range of values

slice

{dplyr}

Subset rows using their positions

ggplot

{GGPLOT2}

Create a ggplot graph

levels

{base}

Get levels of a factor

spread

{tidyr}

Spread a key-value pair across multiple columns

save

{base}

Writes an external representation of R objects to the specified file.

head

{utils}

Show first 5 rows of a data frame

write_dta

NA

read_dta

{haven}

Read a .dta file (Stata data)

median

{stats}

Get median of a vector

The end!